```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nginx HTTP/3 配置指南 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.7;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%);
        }
        .code-block {
            background-color: #282c34;
            border-left: 4px solid #3a7bd5;
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .timeline-item::before {
            content: '';
            position: absolute;
            left: -38px;
            top: 8px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #3a7bd5;
            border: 3px solid #fff;
            box-shadow: 0 0 0 2px #3a7bd5;
        }
        .timeline {
            border-left: 2px solid #e2e8f0;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">Nginx HTTP/3 配置指南</h1>
                    <p class="text-xl mb-8 opacity-90">探索下一代网络协议，提升网站性能与安全性</p>
                    <div class="flex space-x-4">
                        <a href="#installation" class="bg-white text-blue-600 hover:bg-blue-50 px-6 py-3 rounded-lg font-medium transition-all duration-300">
                            <i class="fas fa-download mr-2"></i>开始安装
                        </a>
                        <a href="#config" class="border-2 border-white hover:bg-white hover:bg-opacity-10 px-6 py-3 rounded-lg font-medium transition-all duration-300">
                            <i class="fas fa-cog mr-2"></i>配置指南
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-white bg-opacity-10 p-8 rounded-xl backdrop-blur-sm">
                        <div class="mermaid">
                            graph TD
                                A[HTTP/3] --> B[基于QUIC协议]
                                B --> C[UDP传输]
                                A --> D[多路复用]
                                A --> E[零RTT连接]
                                A --> F[改进的拥塞控制]
                                style A fill:#3a7bd5,color:#fff
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Features Section -->
    <section class="py-16 bg-white">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl font-bold mb-4">为什么选择 HTTP/3？</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">HTTP/3 是基于 QUIC 协议的下一代 HTTP 协议，解决了 HTTP/2 的队头阻塞问题，提供更快的连接建立和更可靠的传输。</p>
            </div>
            <div class="grid md:grid-cols-3 gap-8">
                <div class="feature-card bg-white p-8 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-500 text-4xl mb-4">
                        <i class="fas fa-bolt"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">更快速度</h3>
                    <p class="text-gray-600">零往返时间(0-RTT)连接重建，显著减少延迟，提升页面加载速度。</p>
                </div>
                <div class="feature-card bg-white p-8 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-500 text-4xl mb-4">
                        <i class="fas fa-shield-alt"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">增强安全</h3>
                    <p class="text-gray-600">默认加密所有数据，使用 TLS 1.3，提供更强的安全保障。</p>
                </div>
                <div class="feature-card bg-white p-8 rounded-xl shadow-md transition-all duration-300">
                    <div class="text-blue-500 text-4xl mb-4">
                        <i class="fas fa-network-wired"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3">可靠连接</h3>
                    <p class="text-gray-600">基于UDP，在网络切换时保持连接，特别适合移动设备。</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Installation Section -->
    <section id="installation" class="py-16 bg-gray-50">
        <div class="container mx-auto max-w-6xl px-4">
            <h2 class="text-3xl font-bold mb-12 text-center">安装支持 HTTP/3 的 Nginx</h2>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-12">
                <div class="p-6 border-b border-gray-200">
                    <h3 class="text-xl font-bold flex items-center">
                        <i class="fas fa-server text-blue-500 mr-3"></i>
                        <span>1.1 编译安装 Nginx（支持 HTTP/3）</span>
                    </h3>
                </div>
                <div class="p-6">
                    <h4 class="font-bold text-lg mb-4 text-gray-700">安装依赖项：</h4>
                    <div class="code-block rounded-lg p-4 mb-6 text-gray-200 overflow-x-auto">
                        <pre><code>sudo apt-get update
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libpcre3 libpcre3-dev</code></pre>
                    </div>
                    
                    <h4 class="font-bold text-lg mb-4 text-gray-700">下载和编译 Nginx：</h4>
                    <div class="code-block rounded-lg p-4 mb-6 text-gray-200 overflow-x-auto">
                        <pre><code># 下载 Nginx 源码
wget https://nginx.org/download/nginx-1.23.0.tar.gz
tar -zxvf nginx-1.23.0.tar.gz
cd nginx-1.23.0

# 下载和解压 ngx_brotli 和 quic 模块
git clone https://github.com/google/ngx_brotli.git
git clone https://github.com/nginx-quic/ngx_http_quic_module.git

# 配置、编译和安装 Nginx
./configure --prefix=/usr/local/nginx \
            --add-module=./ngx_brotli \
            --add-module=./ngx_http_quic_module \
            --with-http_v3_module \
            --with-cc-opt="-I/usr/local/openssl/include" \
            --with-ld-opt="-L/usr/local/openssl/lib"

make
sudo make install</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="relative timeline pl-10">
                <h3 class="text-2xl font-bold mb-8 flex items-center">
                    <i class="fas fa-history text-blue-500 mr-3"></i>
                    <span>HTTP 协议演变历程</span>
                </h3>
                
                <div class="mb-12 relative timeline-item">
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-bold mb-2">HTTP/1.1 (1997)</h4>
                        <p class="text-gray-600">持久连接，管道化，但存在队头阻塞问题</p>
                    </div>
                </div>
                
                <div class="mb-12 relative timeline-item">
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-bold mb-2">HTTP/2 (2015)</h4>
                        <p class="text-gray-600">二进制协议，多路复用，头部压缩，但仍基于TCP</p>
                    </div>
                </div>
                
                <div class="mb-12 relative timeline-item">
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <h4 class="text-lg font-bold mb-2">HTTP/3 (2022)</h4>
                        <p class="text-gray-600">基于QUIC协议，使用UDP传输，解决队头阻塞问题</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Configuration Section -->
    <section id="config" class="py-16 bg-white">
        <div class="container mx-auto max-w-6xl px-4">
            <h2 class="text-3xl font-bold mb-12 text-center">配置 Nginx 支持 HTTP/3</h2>
            
            <div class="bg-gray-50 rounded-xl shadow-md overflow-hidden mb-12">
                <div class="p-6 border-b border-gray-200 bg-gray-100">
                    <h3 class="text-xl font-bold flex items-center">
                        <i class="fas fa-file-code text-blue-500 mr-3"></i>
                        <span>2.1 配置示例 (nginx.conf)</span>
                    </h3>
                </div>
                <div class="p-6">
                    <div class="code-block rounded-lg p-4 text-gray-200 overflow-x-auto">
                        <pre><code>http {
    # 启用 HTTP/3
    server {
        listen 443 ssl http2;
        listen 443 quic reuseport;

        # SSL/TLS 配置
        ssl_certificate /path/to/your/cert.pem;
        ssl_certificate_key /path/to/your/key.pem;
        ssl_protocols TLSv1.3;
        ssl_prefer_server_ciphers off;

        # QUIC 配置
        ssl_quic on;
        ssl_early_data on;

        # HTTP/3 配置
        http3_max_idle_timeout 5m;
        http3_max_requests 1000;

        # 其他配置
        location / {
            proxy_pass http://backend;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        # QUIC 和 HTTP/3 设置
        add_header Alt-Svc 'h3-23=":443"'; # HTTP/3 使用的协议标识符
        add_header X-Content-Type-Options nosniff;
    }

    # HTTP/2 和 HTTP/3 配置
    server {
        listen 80;
        server_name demo.com;

        location / {
            return 301 https://$host$request_uri;
        }
    }
}</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-gray-50 p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold mb-4 flex items-center">
                        <i class="fas fa-check-circle text-blue-500 mr-3"></i>
                        <span>关键配置说明</span>
                    </h3>
                    <ul class="space-y-3">
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span><code>listen 443 quic reuseport</code>: 启用QUIC协议和端口重用</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span><code>ssl_quic on</code>: 启用QUIC支持</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span><code>http3_max_idle_timeout</code>: 设置HTTP/3空闲超时</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
                            <span><code>Alt-Svc</code>头: 向客户端通告HTTP/3支持</span>
                        </li>
                    </ul>
                </div>
                
                <div class="bg-gray-50 p-6 rounded-xl shadow-md">
                    <h3 class="text-xl font-bold mb-4 flex items-center">
                        <i class="fas fa-exclamation-triangle text-yellow-500 mr-3"></i>
                        <span>注意事项</span>
                    </h3>
                    <ul class="space-y-3">
                        <li class="flex items-start">
                            <i class="fas fa-info-circle text-blue-500 mt-1 mr-2"></i>
                            <span>HTTP/3仅在使用TLS 1.3时有效</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-info-circle text-blue-500 mt-1 mr-2"></i>
                            <span>并非所有浏览器都支持HTTP/3</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-info-circle text-blue-500 mt-1 mr-2"></i>
                            <span>QUIC使用UDP端口443，确保防火墙允许</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-info-circle text-blue-500 mt-1 mr-2"></i>
                            <span>监控和调整QUIC/HTTP/3配置以获得最佳性能</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </section>

    <!-- Verification Section -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto max-w-6xl px-4">
            <h2 class="text-3xl font-bold mb-12 text-center">验证 HTTP/3 配置</h2>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-6 border-b border-gray-200">
                    <h3 class="text-xl font-bold flex items-center">
                        <i class="fas fa-search text-blue-500 mr-3"></i>
                        <span>3. 启动和验证</span>
                    </h3>
                </div>
                <div class="p-6">
                    <h4 class="font-bold text-lg mb-4 text-gray-700">重启 Nginx:</h4>
                    <div class="code-block rounded-lg p-4 mb-6 text-gray-200 overflow-x-auto">
                        <pre><code>sudo /usr/local/nginx/sbin/nginx -s reload</code></pre>
                    </div>
                    
                    <h4 class="font-bold text-lg mb-4 text-gray-700">使用 curl 测试 HTTP/3:</h4>
                    <div class="code-block rounded-lg p-4 mb-6 text-gray-200 overflow-x-auto">
                        <pre><code>curl -I --http3 https://example.com</code></pre>
                    </div>
                    
                    <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-6">
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <i class="fas fa-lightbulb text-blue-500 text-xl"></i>
                            </div>
                            <div class="ml-3">
                                <p class="text-blue-700">提示：您可以使用 Chrome 浏览器开发者工具中的"Network"标签，查看协议列(Protocol column)是否为"h3"来验证HTTP/3是否生效。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-2xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">专业的Web技术与开发指南</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition-colors duration-300 flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i>访问我们的语雀主页
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500">
                <p>© 2023 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```